﻿using System;
using System.IO;

namespace Kinect
{
    class GFileReader
    {
        public GFileReader()
        {
            
        }
 
        public double readlnDouble()
        {
            double x = double.Parse(streamReader.ReadLine());
            return x;
        }
        public void readln(ref double x)
        {
            x = double.Parse(streamReader.ReadLine());
        }
        public float test_readln()
        {
            float x = float.Parse(streamReader.ReadLine());
            return x;
        }
        //public System.Windows.Point readln(System.Windows.Point pt)
        //{
        //    pt.X = this.readlnDouble();
        //    pt.Y = this.readlnDouble();
        //    return pt;
        //}
        public void readln(ref System.Windows.Point pt)
        {
            if (pt == null) pt = new System.Windows.Point();
            pt.X = this.readlnDouble();
            pt.Y = this.readlnDouble();
        }
        public void readln(ref GPoint pt)
        {
            if (pt == null) pt = new GPoint();
            pt.x = this.readlnDouble();
            pt.y = this.readlnDouble();
        }
        public void readln(ref Microsoft.Xna.Framework.Vector3 vec)
        {
            if (vec == null) vec = new Microsoft.Xna.Framework.Vector3();
            vec.X = (float)this.readlnDouble();
            vec.Y = (float)this.readlnDouble();
            vec.Z = (float)this.readlnDouble();
        }
        FileStream fileStream;
        StreamReader streamReader;
        public void close()
        {
            fileStream.Close();
            streamReader.Close();
        }
        public void open(String fileName = @"e:\log.txt")
        { 
//            String fileName = @"e:\log.txt";
            FileMode fileMode = FileMode.Open;
            fileStream = new FileStream(fileName, fileMode);
            streamReader = new StreamReader(fileStream);
        }
    }
}
